package inheritancedemo;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2023-10-18
 * Time：22:35
 */
class Animal {
    public String name;
    public int age;
    public String sex;
    public void eat() {
        System.out.println(this.name + "吃饭");
    }
    public void sleep() {
        System.out.println(this.name + "睡觉");
    }

    public void setName(String name) {
        this.name = name;
    }
}
class Cat extends Animal {
    public void mew() {
        System.out.println(this.name + "cat::mew()~");
    }
}
class Dog extends Animal {
    public void bark() {
        System.out.println(this.name + "dog::bark()!");
    }
}
public class TestDemo {
    public static void main(String[] args) {
        Cat cat = new Cat();
        cat.setName("米米");
        cat.eat();
        cat.sleep();
        cat.mew();
    }
}
